package com.fg.cloud.manager.service.task.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.fg.cloud.manager.mapper.factory.FactoryStatementMapper;
import com.fg.cloud.manager.service.task.CloudTaskService;

/**
 * @author ：
 * @date   ： 2017年6月9日 下午4:59:19
 * @Desc   ：定时任务
 */
@Component
public class CloudTaskServiceImpl implements CloudTaskService{
	
	@Autowired
	private FactoryStatementMapper statementMapper;
	
	// 测试自动任务
	@Scheduled(cron="11 * * * * ?")
	public void autoTaskTest() {
		Date dateTime = new Date();
		//String strDate = dateTime.toString("yyyy-MM-dd HH:mm:ss");
		// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd
		// HH:mm:ss");//设置日期格式
		// System.out.println(df.format(new Date()));// new Date()为获取当前系统时间
		System.out.println(dateTime.getTime());
	}

	@Override
	@Transactional
	public void autoConfirm() {
		//statementMapper.autoConfirm();
		System.out.println("自动确认对账单:..."+new Date().getTime());
	}

	@Override
	@Transactional
	public void autoPush() {
		//statementMapper.autoPush();
		System.out.println("自动推送对账单:..."+new Date().getTime());
	}
}
